import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { Plugin } from 'vite'



export default function autoImport (plugins:Plugin[]){
  plugins.push(
    AutoImport({
      resolvers: [ElementPlusResolver()], //element-plus自动导入，我们不需要再导入

      //vue vue-router的自动导入(我这里没有使用)
      // imports:['vue','vue-router'],
      //    //为true时在项目根目录自动创建
      //    dts:'types/auto-imports.d.ts' 
    }),
    Components({
      resolvers: [ElementPlusResolver()],
      dirs:['src/components'] ,//按需加载src/components
      //啊句简名称包含目录，防止同名组件冲突
      directoryAsNamespace:true,
      //指定类型声明文件。为true时在项目根目录创建
      dts:'types/components.d.ts'
    })
  ) 
   
}